Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(release): default to 'patch' for --first-release with conventiona… #21491

Closed
wants to merge 2 commits into from

Conversation

nkalinov
Copy link

@nkalinov nkalinov commented Feb 1, 2024

…l commits without relevant commits or previous versions

Current Behavior

Setting up the first release for repos that don't follow conventional commits yet (but want to) OR only have chore: commits (or similar "non-release" commits) will fail with:

> npx nx release --first-release --dry-run 
...
foo 🚫 No changes were detected using git history and the conventional commits standard.
foo 🚫 Skipping versioning "foo" as no changes were detected.

Wasn't immediately obvious (to me at least) what's wrong.

Expected Behavior

I know this can be worked around by rebasing or pushing new conventional commit but I figured I'll take the opportunity to get some exposure to this awesome project and make a quick contribution.
Feel free to disagree of course if this default doesn't make sense to you.
Basically the change is to set a default specifier to patch on such first releases:

> npx nx release --first-release --dry-run 
...
UPDATE libs/foo/package.json [dry-run]

    "name": "foo",
-   "version": "0.0.1",
+   "version": "0.0.2",

Related Issue(s)

…l commits without relevant commits or previous versions
@nkalinov nkalinov requested a review from a team as a code owner February 1, 2024 16:48
Copy link

vercel bot commented Feb 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview May 21, 2024 2:23pm

@JamesHenry
Copy link
Collaborator

JamesHenry commented May 21, 2024

Thank you for the kind words and contribution @nkalinov but I don't think we want to move in this direction.

--first-release is just a flag that is imperatively passed by you. We are not able to offer any guarantees that it is truly the first release, and it relaxes a number of restrictions. If we behaved how you describe here it is likely to lead to users inadvertently continuing to use it with conventional-commits and continuing to apply inappropriate patches, thereby negating the value/purpose of conventional commits.

The error message seems relatively clear to me, your git history does not align with the conventional commits standard right now, so the solution is to either add a commit which does, or imperatively pass any valid specifier, such as patch when you invoke the command.

With hindsight and now understanding the issue better, is there anything that you feel could be improved about the error message?

I will close this in the meantime for clarity. Thanks again!

@JamesHenry JamesHenry closed this May 21, 2024
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants